﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>创建树形</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" /><link href="../demo.css" rel="stylesheet" type="text/css" />

    
    <script src="../../scripts/boot.js" type="text/javascript"></script>
    
    

</head>
<body>
    <h1>创建树形</h1>      

    
    <h4>方式一：加载url（JSON）</h4>
    <ul id="tree1" class="mini-tree" url="../data/listTree.txt" style="width:200px;padding:5px;" 
        showTreeIcon="true" textField="text" idField="id" parentField="pid" resultAsTree="false"          
        
        >
    </ul>
    这里查看JSON数据：<a href="../data/tree.txt" target="_blank">tree.txt</a>
        
    <h4>方式二：HTML标签节点</h4>
    
    
        <ul id="tree2" class="mini-tree" style="width:200px;padding:5px;" showTreeIcon="true">
            <li>
		        <span>MiniUI</span>
		        <ul>
			        <li>
			            <span expanded="false">Form</span>
			            <ul>				           
                            <li>ComboBox</li>
                            <li>DatePicker</li>
                            <li>Spinner</li>
                            <li>TreeSelect</li>
			            </ul>
		            </li>
                    <li>
			            <span expanded="false">Lists</span>
			            <ul>
				            <li><a href="../datagrid/datagrid.html" target="_blank" style="color:Blue;text-decoration:underline;">DataGrid</a></li>
					        <li>Tree</li>
			            </ul>
		            </li>	
                    <li>
			            <span expanded="false">Layouts</span>
			            <ul>
				            <li>Panel</li>
					        <li>Splitter</li>
                            <li>Layout</li>
			            </ul>
		            </li>		 
                    <li>
			            <span expanded="false">Navigations</span>
			            <ul>
				            <li>Tabs</li>
					        <li>NavBar</li>
                            <li>Menu</li>
                            <li>Pager</li>                            
			            </ul>
		            </li>	         
		        </ul>
	        </li>	                   
        </ul>
  
    <h4>方式三：Javascript对象（loadList）</h4>
    <ul id="tree3" class="mini-tree" style="width:300px;padding:5px;" 
        showTreeIcon="true" textField="text" idField="id" >        
    </ul>

    <h4>方式四：Javascript对象（loadData）</h4>
    <ul id="tree4" class="mini-tree" style="width:300px;padding:5px;" 
        showTreeIcon="true" textField="text" idField="id" >        
    </ul>
        

    <script type="text/javascript">
        mini.parse();

        ////////////////////////////////////
        var list = [
	        { id: "base", text: "Base" },            
	        { id: "ajax", text: "Ajax", pid: "base" },
	        { id: "json", text: "JSON", pid: "base" },
	        { id: "date", text: "Date", pid: "base" },
	        { id: "control", text: "Control", pid: "base" },
	        { id: "forms", text: "Forms", pid: "base" },
	        { id: "button", text: "Button", pid: "forms" },
	        { id: "listbox", text: "ListBox", pid: "forms" },
	        { id: "checkboxlist", text: "CheckBoxList", pid: "forms" },
            { id: "lists", text: "Lists" },
	        { id: "datagrid", text: "DataGrid", pid: "lists" },
	        { id: "tree", text: "Tree", pid: "lists" },
	        { id: "treegrid", text: "TreeGrid ", pid: "lists" }
        ];
	    var tree3 = mini.get("tree4");
	    tree3.loadList(list, "id", "pid");

	    ///////////////////////////////////

	    var dataTree = [
            { id: "lists", text: "Lists", expanded: false,
                children: [
			        { id: "datagrid", text: "DataGrid" },
			        { id: "tree", text: "Tree" },
			        { id: "treegrid", text: "TreeGrid " }
		        ]
            },
	        { id: "layouts", text: "Layouts", expanded: false,
	            children: [
			        { id: "panel", text: "Panel" },
			        { id: "splitter", text: "Splitter" },
			        { id: "layout", text: "Layout " }
		        ]
	        },
	        { id: "navigations", text: "Navigations", expanded: false,
	            children: [
			        { id: "pager", text: "Pager" },
			        { id: "tabs", text: "Tabs" },
			        { id: "navbar", text: "NavBar" },
			        { id: "menu", text: "Menu" }
		        ]
	        }
        ];

	    var tree4 = mini.get("tree3");
	    tree4.loadData(dataTree);
    </script>

    

    <div class="description">
        <h3>Description</h3>
        <p>            
        </p>
    </div>
</body>
</html>